<%--
  Created by IntelliJ IDEA.
  User: Aqqqwer
  Date: 2021/7/7
  Time: 9:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改用户页面</title>
</head>
<style>
    @import "/css/daohang.css";
    @import "/css/header.css";
</style>
<div class="header_bd">
    <!-- 头部 -->

    <div class="header" >
        <h1><img style="height: 50px;width: 180px"
                 src="">
        </h1>
        <form>
            <input type="text" name="search" placeholder="Search.." class="search">
        </form>
        <button class="searchButton searchButton2">立即搜索</button>
        <div class="login"  >
            <!-- 登录 -->
            <!-- 注册 -->
            <span><a href="login_user.jsp" ><input type="button" class="dlspan" value="登 录" /></a></span>&nbsp;&nbsp;
            <span><a href="register_user.jsp" ><input type="button" class="zcspan" value="注 册" /></a></span>
        </div>
    </div>
    <div>
        <div class="topNav">
            <!-- 导航栏 -->
            <div style="float: left;">
                <button style="" class="links_button button dropdown">
                    <a href="tuijian.jsp" style="text-decoration: none">推荐</a>
                    <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
                </button>
                <button style="" class="links_button button dropdown">
                    <a href="yingshi.jsp" style="text-decoration: none">影视</a>
                    <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
                </button>
                <button style="" class="links_button button dropdown">
                    <a href="yinyue.jsp" style="text-decoration: none">音乐</a>
                    <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
                </button>
                <button style="" class="links_button button dropdown">
                    <a href="youxi.jsp" style="text-decoration: none">游戏</a>
                    <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
                </button>
                <button style="" class="links_button button dropdown">
                    <a href="tiyu.jsp" style="text-decoration: none">体育</a>
                    <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
                </button>
                <button style="" class="links_button button dropdown">
                    <a href="zongyi.jsp" style="text-decoration: none">综艺</a>
                    <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
                </button>
                <button style="" class="links_button button dropdown">
                    <a href="yule.jsp" style="text-decoration: none">娱乐</a>
                    <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
                </button>
                <button style="" class="links_button button dropdown">
                    <a href="dongman.jsp" style="text-decoration: none">动漫</a>
                    <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
                </button>
                <button style="" class="links_button button dropdown">
                    <a href="shenghuo.jsp" style="text-decoration: none">生活</a>
                    <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
                </button>
                <button style="" class="links_button button dropdown">
                    <a href="meishi.jsp" style="text-decoration: none">美食</a>
                    <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
                </button>
                <button style="" class="links_button button dropdown">
                    <a href="chongwu.jsp" style="text-decoration: none">宠物</a>
                    <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
                </button>
            </div>
        </div>
    </div>
</div>
<script src="/js/jquery-3.4.1.min.js"></script>
<script>
    $(function () {
        //发送ajac请求
        $.ajax({
            url: '/user/selectTwo',
            type: 'GET',
            data: {
                id: '${param.id}'
            }, dataType: 'json',
            success: function (data) {
                console.info(data);
                //设置修改form表单数据
                var name=data.name;
                $(':text[name="name"]').val(name);
                var phone=date.phone;
                $(':text[name="phone"]').val(phone);
                var realName=data.real_name;
                $(':text[name="real_name"]').val(realName);
                var age=data.age;
                $('text[name="age]').val(age);
                var sex=data.sex;
                $(':radio[value='+sex+']').prop('checked',true);
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                console.info('加载用户信息失败【' + textStatus + '】')
            }
        })
    });
</script>
<style>
    .s{
        line-height:50px;
        margin-right:30px;
        float:left;
    }
</style>
<body>
<div style="width:100%;height:100%;background-color: aquamarine">
<form action="/user/update_user" method="post">
    <div style="background-color:yellow;border:solid;border-color:red;width:350px;height:400px;position: fixed;left:500px;top:200px">
    <ul style="list-style: none;line-height: 28px">
        <li><h3 style="text-align:center;background-color:blue;letter-spacing:15px">修改用户</h3></li>
        <li><span class="s">用户名:<input type="text" name="name" placeholder="请输入用户名" required></span></li>
        <li><span class="s">电话号码:<input type="text" name="phone" placeholder="请输入电话号码" required></span></li>
        <li><span class="s">真实姓名:<input type="text" name="real_name" placeholder="请输入真实姓名" required></span></li>
        <li><span class="s">年龄:<input type="number" name="age" placeholder="请输入你的年龄" required></span></li>
        <li><span class="s">性别:
            <label><input type="radio" name="sex" value="1">男</label>
            <label><input type="radio" name="sex" value="2">女</label></span>
        </li>
        <li><input type="hidden" name="id" value="${param.id}"></li>
        <li>
            <span class="s"><button type="submit">修改用户</button>
            <button type="reset">重新填写</button></span>
        </li>
    </ul>
    </div>
</form>
</div>
</body>
</html>
